package com.culturalCenter.dataCenter.controller.web;

import com.culturalCenter.dataCenter.Utils.ApiResult;
import com.culturalCenter.dataCenter.Utils.ResultCode;
import com.culturalCenter.dataCenter.entity.monitor.Meteorograph;
import com.culturalCenter.dataCenter.globalconfig.Interface.ApiVersion;
import com.culturalCenter.dataCenter.globalconfig.Interface.CustomVersion;
import com.culturalCenter.dataCenter.mapper.weather.NewWeatherMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.culturalCenter.dataCenter.Utils.ApiResult.instance;

/**
 * 天气
 *
 * @Author zhao
 * @Date 2021-9-6 15:58
 */
@RestController
@RequestMapping("/{version}/weather")
@Api(tags = "天气")
@ApiVersion(CustomVersion.VERSION_1)
@Slf4j
public class NewWeatherController {

    @Resource
    private NewWeatherMapper weatherMapper;

    /**
     * 天气
     */
    @ApiOperation(value = "天气")
    @GetMapping("/getWeather")
    public ApiResult<Meteorograph> select() {
        Meteorograph meteorograph = weatherMapper.selectNew();
        return instance(ResultCode.SUCCESS, meteorograph);
    }

}
